// http://api.douban.com/v2/movie/subject/1764796?apikey=0df993c66c0c636e29ecbb5344252a4a
const rp = require('request-promise-native')

const fetchMovie = async (item)=>{
  const url = `http://api.douban.com/v2/movie/subject/${item.doubanId}?apikey=0df993c66c0c636e29ecbb5344252a4a`
  const res = await rp(url);
  return res;
};

(async ()=> {
  let movies = [
  //   {
  //   doubanId: 26698897,
  //   title: '唐人街探案2',
  //   rate: 6.6,
  //   poster: 'https://img1.doubanio.com/view/photo/l_ratio_poster/public/p2512717519.jpg'
  // },
    {
      doubanId: 1306249,
      title: '唐伯虎点秋香',
      rate: 8.6,
      poster: 'https://img3.doubanio.com/view/photo/l_ratio_poster/public/p1946455272.jpg'
    }];

  movies.map(async movie => {
    let movieData = await fetchMovie(movie);
    console.log(movieData);
  });
})();
